package com.videri.match.client;

import com.allen_sauer.gwt.dragdrop.client.drop.DropController;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MouseListener;
import com.google.gwt.user.client.ui.SourcesMouseEvents;
import com.google.gwt.user.client.ui.Widget;

	public class StringBoxPair extends Composite
	{
		private static final String CSS_MATCH_STRING_FOCUSPANEL = "match-string-focuspanel";
		private StringBoxDropController dropController;
		private HorizontalPanel myHorizontalPanel;
		public StringBoxPair(String s, int r, int g, int b)
		{
			myHorizontalPanel = new HorizontalPanel();
			FocusPanel fp = new FocusPanel();
			fp.setWidth("12em");
			fp.setHeight("15px");
			DOM.setStyleAttribute(fp.getElement(), "backgroundColor", "rgb("+r+", "+g+", "+b+")");
			dropController = new StringBoxDropController(fp);
			myHorizontalPanel.add(fp);
			Label label = new Label(s);
			label.setHeight("15px");
			label.setWidth("12em");
			myHorizontalPanel.add(label);
			initWidget(myHorizontalPanel);
			addStyleName(CSS_MATCH_STRING_FOCUSPANEL);
		}
		public StringBoxPair(Image i, int r, int g, int b)
		{
			myHorizontalPanel = new HorizontalPanel();
			FocusPanel fp = new FocusPanel();
			fp.setWidth("12em");
			fp.setHeight(i.getHeight() + "px");
			DOM.setStyleAttribute(fp.getElement(), "backgroundColor", "rgb("+r+", "+g+", "+b+")");
			dropController = new StringBoxDropController(fp);
			myHorizontalPanel.add(fp);
			myHorizontalPanel.add(i);
			initWidget(myHorizontalPanel);
			addStyleName(CSS_MATCH_STRING_FOCUSPANEL);
		}

		public DropController getDropController()
		{
			return dropController;
		}
		
		public Widget[] getDropped() {
			return dropController.getDropped();
		}
	}
